Skip to content

test(ts-plugin): split diagnostics and file-operation e2e tests#381

Merged
mizdra merged 10 commits into
mainfrom
test/e2e-test-diagnostics-and-file-operation
May 5, 2026
Merged

test(ts-plugin): split diagnostics and file-operation e2e tests#381
mizdra merged 10 commits into
mainfrom
test/e2e-test-diagnostics-and-file-operation

Conversation

@mizdra
Copy link
Copy Markdown
Owner

@mizdra mizdra commented May 4, 2026

Summary

Refactor packages/ts-plugin/e2e-test/feature/{semantic,syntactic}-diagnostics.test.ts and packages/ts-plugin/e2e-test/file-operation.test.ts so that each test block owns a minimal fixture and asserts a single behavior.

This is the 4th PR of a multi-PR series (see #378 for the first PR / overall context).

What's new

  • packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts: rewritten as 3 behavior-focused tests:
    • a TS-side TS2339 access on the styles binding;
    • a structural type assignment (type Expected = { a_1: string }; const _t: Expected = styles;) that verifies the .d.ts-generated token map is exposed on the styles binding (replaces the old const t1: Expected = styles; const t2: typeof styles = t1; check that lived inside the original 1-test fixture);
    • a representative CSS-side semantic diagnostic via an unresolvable @import. Exhaustive coverage of every diagnostic kind lives in packages/core/src/checker.test.ts.
  • packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts: rewritten as 1 representative test for a CSS-side syntactic diagnostic (@value;). Exhaustive coverage lives in the parser tests under packages/core/src/parser/.
  • packages/ts-plugin/e2e-test/file-operation.test.ts: rewritten so each describe (when adding, when updating, when removing a CSS module) owns 1 test focused on whether the importer's diagnostic is updated. when adding retains the original tsserver caching bug as a NOTE.

Test structure

namedExports: $namedExports
├── feature/semantic-diagnostics.test.ts (3 tests)
│   ├── reports an unknown property access on a styles binding
│   ├── provides the .d.ts-generated type on the styles binding
│   └── reports a semantic diagnostic on a CSS module file
├── feature/syntactic-diagnostics.test.ts (1 test)
│   └── reports a syntactic diagnostic on a CSS module file
└── file-operation.test.ts (2 tests + 1 todo)
    ├── when adding a CSS module
    │   └── updates the importer's diagnostic when a CSS module is added
    ├── when updating a CSS module
    │   └── updates the importer's diagnostic when a CSS module is modified
    └── when removing a CSS module
        └── todo: updates the importer's diagnostic when a CSS module is removed

Total: 6 tests + 1 todo × 2 variants = 12 tests + 2 todo.

Test plan

  • vp test --project e2e packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts — 2 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts — 6 passed
  • vp test --project e2e packages/ts-plugin/e2e-test/file-operation.test.ts — 4 passed + 2 todo
  • vp test --project e2e (full e2e suite) — no regressions
  • vp check (format + lint + type) — pass for changed files

🤖 Generated with Claude Code

mizdra and others added 8 commits May 4, 2026 22:25
…per-behavior cases

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…test

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…e representative case

Exhaustive coverage of core checker diagnostic kinds is owned by
packages/core/src/checker.test.ts. The e2e test now keeps only one
representative case to verify that a CSS-side diagnostic surfaces in
tsserver via ts-plugin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…t to focus on the behavior

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…le representative case

Exhaustive coverage of parser-side diagnostic kinds is owned by the
parser tests under packages/core/src/parser/. The e2e test now keeps
only one representative case to verify that a CSS-side syntactic
diagnostic surfaces in tsserver via ts-plugin.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… diagnostic updates

Restore the original 1-test-per-file-operation structure and rename
each test to focus on the behavior being verified: that adding,
modifying, or removing a CSS module updates the importer's
diagnostics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

⚠️ No Changeset found

Latest commit: ec693dc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mizdra mizdra added the Type: Testing Adding missing tests or correcting existing tests label May 4, 2026
@mizdra mizdra requested a review from Copilot May 4, 2026 16:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors the ts-plugin e2e suite toward smaller, behavior-focused fixtures and adds hover coverage so tsserver quickinfo is exercised alongside diagnostics and file-operation flows. This fits the ongoing test-suite cleanup work in the ts-plugin package by making individual behaviors easier to isolate and extend.

Changes:

  • Split semantic and syntactic diagnostics e2e tests into smaller representative cases.
  • Reworked file-operation e2e coverage into per-scenario tests for add/update/remove flows.
  • Added a new hover e2e test and a sendQuickInfo tsserver helper to exercise quickinfo.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/ts-plugin/e2e-test/test-util/tsserver.ts Adds a sendQuickInfo helper for tsserver requests used by the new hover coverage.
packages/ts-plugin/e2e-test/file-operation.test.ts Rewrites file-operation coverage into smaller add/update/remove test cases.
packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts Narrows syntactic diagnostics e2e coverage to a single representative CSS parse error.
packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts Splits semantic diagnostics coverage into a TS-side styles access error and a CSS-side semantic error.
packages/ts-plugin/e2e-test/feature/hover.test.ts Adds new quickinfo-based hover coverage for CSS module token types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/ts-plugin/e2e-test/file-operation.test.ts
Comment thread packages/ts-plugin/e2e-test/feature/semantic-diagnostics.test.ts
Comment thread packages/ts-plugin/e2e-test/feature/syntactic-diagnostics.test.ts
Comment thread packages/ts-plugin/e2e-test/feature/hover.test.ts Outdated
mizdra and others added 2 commits May 5, 2026 11:52
…antic-diagnostics e2e

Replaces the reverted hover-based check with a structural type
assignment (`type Expected = { a_1: string }; const _t: Expected = styles;`)
inside semantic-diagnostics.test.ts. This avoids hard-coding the
TypeScript compiler's hover wording while still exercising the
.d.ts-generated type on the styles binding.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mizdra mizdra merged commit 43f82ae into main May 5, 2026
20 checks passed
@mizdra mizdra deleted the test/e2e-test-diagnostics-and-file-operation branch May 5, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Testing Adding missing tests or correcting existing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants